{% extends 'base.html' %}

{% block extra-head %}
<link rel="stylesheet" type="text/css"  media="screen" href="{{ MEDIA_URL }}tasks/tasks.css" />
<link rel="stylesheet" type="text/css"  media="screen" href="{{ MEDIA_URL }}user.css" />
{% endblock %}

{% block title %}Tasks{% endblock %}
{% block section %}tasks{% endblock %}

{% block content %}
<div class="span-5">
 <div class="gradient-box">
 {% if first_time %}
   <p>Hi {{ user.private_name}}, and thanks for joining Democracy Club! You've joined thousands of people across the country to create a powerful team of volunteers who want to hold our representatives to account.</p>
 {% endif %}
 <h2>Your Democracy Club tasks</h2>
 {% if not user.is_active %}
    <p>You need to activate your account to participate in the website. Please check your inbox (and your spam folder) for a confirmation email.</p>
 {% else %} 
  {% if open_tasks or ignored_tasks %}
   <span class="quiet">Click on a task title to see more information. {% if ignored_tasks %}<a onclick="$('.task-ignored').toggle();">Show ignored tasks</a>{% endif %}</span>
   {% if open_tasks %}
     {% with open_tasks as usertasks %}
       {% include "tasks/task_list.html" %}
     {% endwith %}
     {% ifequal open_tasks.count ignored_tasks.count %}
        <p id="ignored_tasks_notice">You have ignored tasks, <a onclick="$('#ignored_tasks_notice').hide();$('.task-ignored').show();">click here to show them</a>.</p>
     {% endifequal %}
   {% endif %}
  {% else %}
    <p>There are no tasks currently assigned to you.</p>
  {% endif %}
 {% endif %}
  <div class="clear"> </div>
  </div>
  <h4>About your tasks</h4>
  <p>On this page, we display a list of tasks that we've asked you to consider doing. Click on a task title to display more information about the task. Click "begin task" to get started with one of them. You can always ignore a task that you can't do (or don't want to do).</p>
  
  <h3>Recent activity in your {% ifnotequal request.user.constituencies.count 1 %}constituencies{% else %}constituency{% endifnotequal %}</h3>
  {% if activity %}
    {% include "tasks/activity_list.html" %}
  {% else %}
    There has been no activity near you - be the first, do a task! Maybe you need to <a href='{% url inviteindex %}'>invite some friends</a>.
  {% endif %}
  <a href='#' onclick='$(this).hide(); $("#about_activity").show(); return false;' class='help_button'>what is this?</a>
  <div id="about_activity"><h4>About recent activity</h4>
  <p>This shows what people in your constituencies have been doing recently.</p>
  </div>
</div>

<div class="span-3 activity-bar last">
<h3>Your achievements</h3>
    {% if badges %}
        <ul class="badges">
        {% for badge in badges %}
            <li class="badge"><a href='{% url task slug=badge.task.slug %}'>{{ badge.name }}</a><br/>{% ifequal badge.number 1 %}<small>{{ badge.date_awarded.date }}</small>{% else %}&times; {{ badge.number }}{%endifequal%}</li>
        {% endfor %}
        </ul>
    {% else %}
        <p>You've not carried out any tasks yet.  When you do so, you are awarded "badges" for your work.</p>
    {% endif %}
    <p class="clear quiet">Badges don't have any effect on the site; they're simply a sign of accomplishment and bragging rights.</p>

    <br/>
    <script src="http://widgets.twimg.com/j/2/widget.js"></script>
    <script>
    new TWTR.Widget({
      version: 2,
      type: 'profile',
      rpp: 4,
      interval: 6000,
      width: 'auto',
      height: 300,
      theme: {
        shell: {
          background: '#d9f0ff',
          color: '#333333'
        },
        tweets: {
          background: '#ffffff',
          color: '#363636',
          links: '#003da6'
        }
      },
      features: {
        scrollbar: false,
        loop: false,
        live: false,
        hashtags: true,
        timestamp: true,
        avatars: false,
        behavior: 'all'
      }
    }).render().setUser('democlub').start();
    </script>
    <br/>
    <p>We're trying to get volunteers in every part of the UK.  So far, we've recruited {{ volunteers }} volunteers in {{ count }} constituencies (out of a total {{ total }}). <a href="/statistics/">Read more about how we're doing</a>. You can also <a href='http://twitter.com/democlub'>follow us on Twitter</a>.</p>

    <h3>Recent signups</h3>
    {% include "new_signup_list.html" %}
</div>
 
{% endblock %}


{% block js %}
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
 <script type="text/javascript">
   $(document).ready(function () {
	$('div.tasks a.usertask').click(function() {
           
           //var target = $('#task-description div');
           var desc = $(this).parent().parent().parent().find('div.task-description');
           desc.slideToggle(250)
           //target.html(desc.html());
           return false;
	});
    });

 </script>
{% endblock %}

